<?php
/**
 * XmuSlh, web platform of Student Association Federation of Xiamen University
 * 
 * Rewritting one or some pages of StatusNet. 
 * To get the original version, please visit <http://status.net/>.
 * 
 * StatusNet, the distributed open-source microblogging tool
 * 
 * LICENCE: This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

/**
 * 根据查询的结果,返回用于显示的html代码.
 * Data search box.
 * 
 * @author		ytukie <ytukie@gmail.com>
 * @version		0.1
 */

// XmuSlh only.
if ( !defined('XMUSLH')) { exit(1); }

// Requirements.
require_once INSTALLDIR . '/widgets/slh_list_data.php';


class DatasearchresulthtmlAction extends Action
{
/**
	 * The Data object.
	 */
	var $data = null;
	
	
	function prepare($args)
	{
// TODO: Check logged in and rights.
		parent::prepare($args);
		
		// Parameter from 'get' url
		$id = $this->getTrimmedArg('gfile_id');
		
		if ( !is_numeric($id)) {
			return false;
		}
		
		// Get the data.
		$this->data = Data::staticGet('file_id', $id);
		if (empty($this->data)) {
			return false;
		}
		
		return true;
	}
	
	function handle($args)
	{
		parent::handle($args);

		// Return the html code.
		$list = new SingleDataListItem($this->data, $this);
		$list->show();
	}
}

// Rewrite the format.
class SingleDataListItem extends DataListItem
{
	/**
	 * Start a single item.
	 * Overriding.
	 */
	function showStart()
	{
		$this->out->elementStart('div', array('class' => 'cls_div_entry'));
	}
	
	/**
	 * Finish the note news item.
	 */
	function showEnd()
	{
		$this->out->elementEnd('div');
	}
}

?>